package com.lti.appnet.mongodb.configuration;

import java.net.UnknownHostException;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Bean;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;


import com.mongodb.MongoClient;

@Configurable
@EnableMongoRepositories(basePackages = {"com.lti"})
public class MongoDBConfiguration {
	@Bean
	public MongoTemplate mongoTemplate(MongoClient mongo) throws UnknownHostException {
		return new MongoTemplate(new SimpleMongoDbFactory(mongo, "appNet"));
	}

	@Bean
	public MongoClient mongo() throws UnknownHostException {
		return new MongoClient("192.168.163.44",27017);
	}
}
